<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2"/>
    <title>用户: ${this.user.fullName}</title></head>

<body>

<div class="main-body">
    <div class="page-wrapper">
        <!-- Page-header start -->
        <div class="page-header">
            <div class="page-header-title">
                <h4>用户：${this.user.fullName}</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    <li class="breadcrumb-item">
                        <g:link action="index" controller="user">用户列表</g:link>
                    </li>
                    <li class="breadcrumb-item"><a href="#!">用户：${this.user.fullName}</a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- Page-header end -->
        <!-- Page-body start -->
        <div class="page-body">
          <g:if test="${flash.message}">
              <div class="message alert alert-info" role="status">${flash.message}</div>
          </g:if>
          <g:hasErrors bean="${this.user}">
              <ul class="errors" role="alert">
                  <g:eachError bean="${this.user}" var="error">
                      <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                          <g:message error="${error}"/>
                      </li>
                  </g:eachError>
              </ul>
          </g:hasErrors>

            <!-- Hover table card start -->
            <div class="card">
                <div class="card-header">
                    <h5>用户：${this.user.fullName}</h5>
                    <div class="card-header-right">
                      <g:if test = "${this.isAdmin}">
                        <g:link action="preTransferData" id="${this?.user?.id}" data-toggle="tooltip" data-placement="top" data-original-title="资料迁移">
                          <i class="icofont icofont-refresh"></i>
                        </g:link>
                      </g:if>

                        <g:link action="edit" resource="${this.user}" data-toggle="tooltip" data-placement="top"
                                title="" data-original-title="编辑">
                            <i class="icofont icofont-edit"></i>
                        </g:link>

                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block">
                    <div class="form-group row">
                        <div class="col-md-1"><strong>${this.user.username}</strong></div>
                        <!-- <div class="col-md-1"><strong>${this.user?.email}</strong></div> -->
                        <div class="col-md-1"><strong>${this.user?.city?.name}</strong></div>

                        <div class="col-md-1"><strong>${this.user?.department?.name}</strong></div>

                        <div class="col-md-1"><strong class="cellphoneFormat">${this.user.cellphone}</strong></div>

                        <div class="col-md-1"><strong>${this.user?.externalId}</strong></div>
                        <div class="col-md-1"><strong>启用：${this.user?.enabled ? '是' : '否'}</strong></div>

                        <div class="col-md-1"><strong>账户过期：${this.user?.accountExpired ? '是' : '否'}</strong></div>

                        <div class="col-md-1"><strong>账户锁定：${this.user?.accountLocked ? '是' : '否'}</strong></div>

                        <div class="col-md-1"><strong>密码过期：${this.user?.passwordExpired ? '是' : '否'}</strong></div>

                        <div class="col-md-1"><strong>短信登录：${this.user?.loginBySms ? '是' : '否'}</strong></div>

                        <div class="col-md-1"><strong>固定ip：${this.user?.fixedIp ? '是' : '否'}</strong></div>

                     %{--   <label class="col-md-2 col-form-label">用户名称</label>

                        <div class="col-md-3">
                            <span class="cont">${this.user.fullName}</span>
                        </div>--}%

                    </div>

                </div>

            </div>

            <div class="card">
                <div class="card-header">
                    <h5>用户角色</h5>

                    <div class="card-header-right">
                        <g:link action="create" controller="userRole" id="${this.user.id}"
                                data-toggle="tooltip"
                                data-placement="top" title=""
                                data-original-title="增加授权"><i class="icofont icofont-plus"></i></g:link>


                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block dt-responsive">

                    <div class="table-responsive">
                        <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">
                            <div class="table-responsive">
                                <table class="table table-striped table-hover">
                                    <tbody>
                                    <g:each in="${userRoleList}" var="r">
                                        <tr>
                                            <td>${r?.role.description}</td>
                                            <td width="6%">
                                                <sec:ifAllGranted roles="ROLE_ADMINISTRATOR">
                                                    <g:link action="deleteRole" params="[userId: r.user.id, roleId: r.role.id]"
                                                            class="btn btn-danger btn-mini">取消授权</g:link>
                                                </sec:ifAllGranted>
                                            </td>
                                        </tr>
                                    </g:each>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>

            </div>

            <div class="card">
                <div class="card-header">
                    <h5>岗位</h5>

                    <div class="card-header-right">
                        <g:link action="create" controller="userPosition" params="[user: this.user?.id]"
                                data-toggle="tooltip"
                                data-placement="top" title=""
                                data-original-title="增加岗位"><i class="icofont icofont-plus"></i></g:link>
                        <i class="icofont icofont-rounded-down"></i>
                    </div>
                </div>

                <div class="card-block dt-responsive">

                    <div class="table-responsive">
                        <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">
                            <div class="table-responsive">
                                <table class="table table-striped table-hover">
                                    <tbody>
                                    <g:each in="${userPositionList}">
                                        <tr>
                                            <td>${it?.position}</td>
                                            <td width="6%">
                                              <g:form controller="userPosition" action="delete" class="inline"
                                                  id="${it.id}" method="DELETE">
                                                  <button class="deleteBtn text-danger" type="button">
                                                     <i class="icofont icofont-trash"></i>
                                                  </button>
                                              </g:form>
                                            </td>
                                        </tr>
                                    </g:each>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- Hover table card end -->
        </div>

        <!-- Page-body end -->

    </div>
</div>

</body>

</html>
